package com.zhiyou100.service;

import com.zhiyou100.mapper.UserMapper;
import com.zhiyou100.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService {
    @Autowired
    UserMapper mapper;
    public User findUserByLogin(String username, String password) {
        User user = mapper.findUserByLogin(username,password);
        System.out.println("返回的user是   :   "+user);
        return user;
    }

    public ArrayList<Integer> findRolesById(int id) {
        ArrayList<Integer> Roles =  mapper.findRolesById(id);
        return Roles;
    }

    public List<Integer> findPerIdByRoles(ArrayList<Integer> rolenum) {
        List<Integer> perId = mapper.findPermisByRoles(rolenum);
        return perId;
    }

    public List<String> findPerByPerId(List<Integer> perIds) {
        List<String> per =  mapper.findPerByPerId(perIds);
        return  per;
    }

    public List<String> findRoleNameById(ArrayList<Integer> role_ids) {
        System.out.println("service层 "+role_ids);
        List<String> RoleName = mapper.findRoleNameById(role_ids);
        return RoleName;
    }
}
